
malloc1.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <main>:
#include <unistd.h>

#define A_MEGABYTE (1024 * 1024)

int main()
{
   0:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
   4:	910003fd 	mov	x29, sp
  char * some_memory;
  int megabyte = A_MEGABYTE;
   8:	52a00200 	mov	w0, #0x100000              	// #1048576
   c:	b9001ba0 	str	w0, [x29, #24]              ; megabyte
  int exit_code = EXIT_FAILURE;
  10:	52800020 	mov	w0, #0x1                   	// #1
  14:	b9001fa0 	str	w0, [x29, #28]              ; exit_code

  some_memory = (char *)malloc(megabyte);
  18:	b9801ba0 	ldrsw	x0, [x29, #24] ; megabyte
  1c:	94000000 	bl	0 <malloc>
  20:	f9000ba0 	str	x0, [x29, #16] ; some_memory ---> malloc return address
  if (some_memory != NULL) {
  24:	f9400ba0 	ldr	x0, [x29, #16] ; some_memory
  28:	f100001f 	cmp	x0, #0x0
  2c:	540001c0 	b.eq	64 <main+0x64>  // b.none
    sprintf(some_memory, "Hello World\n");
  30:	f9400ba2 	ldr	x2, [x29, #16]   ; some_memory
  34:	90000000 	adrp	x0, 0 <main>
  38:	91000001 	add	x1, x0, #0x0 ; x1 = parameter address
  3c:	aa0203e0 	mov	x0, x2       ; x0 = some_memory
  40:	f9400022 	ldr	x2, [x1]     ; x2 = parameter value
  44:	f9000002 	str	x2, [x0]     ; some_memory = parameter value
  48:	f8405021 	ldur	x1, [x1, #5] ; x1 = *(parameter+5)                      ???????
  4c:	f8005001 	stur	x1, [x0, #5] ; *(some_memory+5) = *(parameter+5)
    printf("%s", some_memory);
  50:	90000000 	adrp	x0, 0 <main>
  54:	91000000 	add	x0, x0, #0x0
  58:	f9400ba1 	ldr	x1, [x29, #16]
  5c:	94000000 	bl	0 <printf>
    exit_code = EXIT_SUCCESS;
  60:	b9001fbf 	str	wzr, [x29, #28]
  }

  exit(exit_code);
  64:	b9401fa0 	ldr	w0, [x29, #28]
  68:	94000000 	bl	0 <exit>
